package mapper;

import com.yh.javabean.Computer;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

public interface ComputerDao {
	///查找所有数据
	List<Computer> selectAll();

	/// 根据id查找数据
	Computer selectById(int id);

	/// 根据studentId与score查找数据
	Computer selectAllByStudentIdAndScore(String stuId,float score);

	/// 根据Computer查找数据
	Computer selectByComputer(Computer computer);

	///根据studentId集合查找数据
	ArrayList<Computer> selectComputerByStudentId(ArrayList<String> IdList);

	/// 添加数据
	int addComputer(Computer computer);

	/// 添加多个数据
	int addMoreComputer(ArrayList<Computer> computerArrayList);

	///根据id进行删除
	int deleteComputer(String id);

	///根据多个数据的id,实现删除多个数据
	int deleteMoreComputer(ArrayList<Computer> computerArrayList);

	/// 根据Id进行更新
	int updateComputer(Computer computer);

	/// 注解开发 查询所有数据
	@Select("select * from school.computer;")
	List<Computer> selAllFromComputer();

	@Delete("delete from school.computer where studentid = #{studentid} ;")
	int delOneFromComputer(Computer computer);

	@Update("update school.computer set score =#{score}  where studentid=#{studentid} ;")
	int updateScoreComputer();

	@Insert("insert into school.computer (studentid, score) values (#{studentid},#{score});")
	int addOneFromComputer(Computer computer);

	/// 注解开发 使用注解绑定 实现自定义参数名称绑定，也就是把mybatis固定的参数arg0,arg1改为自定义的
	Computer selectComputerDiyPram(@Param("stuId") String stuId);

}